package com.tong.hao.common.configuration.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * @ClassName AcHttpSessionListener
 * @Author 友野浩二
 * @Description Session的监听器
 * @Version 1.0
 */
@Component
@WebListener
@Slf4j
public class HaoHttpSessionListener implements HttpSessionListener, HttpSessionAttributeListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        log.info("Hao Common HttpSession created");
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        log.info("Hao Common HttpSession destroyed");
    }

    @Override
    public void attributeAdded(HttpSessionBindingEvent se) {
        log.info("Hao Common HttpSession attribute added");
    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent se) {
        log.info("Hao Common HttpSession attribute removed");
    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent se) {
        log.info("Hao Common HttpSession attribute replaced");
    }
}
